package khiem.gwt.demo.gadgetDesktop.client.gadgets;

import com.google.gwt.user.client.ui.Label;
import khiem.gwt.demo.gadgetDesktop.client.model.Gadget;
import khiem.gwt.demo.gadgetDesktop.client.model.GadgetClass;
import khiem.gwt.demo.gadgetDesktop.client.model.UserPref;

public class HelloWorld extends Gadget {

	public static class Class extends GadgetClass {

		static UserPref text = new UserPref("Text", "Hello World");
		
		public Class(String name) {
			super("HelloWorld");		
			addUserPref(text);
		}
		
		public Gadget newGadget() {
			return new HelloWorld(this);
		}
	}
	
	Label label = new Label();
	
	protected HelloWorld(Class c) {
		super(c);
		initWidget(label);
	}
	
	public void refresh() {
		label.setText((String) getUserPrefValue(Class.text));
	}


}
